//
//  TopicSecondModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/11.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "TopicSecondModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface TopicSecondModelCell ()
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImageView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImageView;
@property (weak, nonatomic) IBOutlet UIImageView *headerImgView;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *cTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *disLabel;

@end
@implementation TopicSecondModelCell
- (void)setModel:(TopicSecondModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    self.contentLabel.text = self.model.content;
    [self.firstImageView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[0]]];
    [self.secondImageView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[1]]];
    self.userNameLabel.text = self.model.userName;
    self.cTimeLabel.text = [NSString stringWithFormat:@"%@",self.model.cTime];
    self.disLabel.text = [NSString stringWithFormat:@"%@跟帖",self.model.discussCount];
    if (self.model.userHeadPicUrl) {
        [self.headerImgView sd_setImageWithURL:[NSURL URLWithString:self.model.userHeadPicUrl]];
    }
    self.headerImgView.image = [UIImage imageNamed:@"t2.gif"];
    self.firstImageView.userInteractionEnabled = YES;
    self.secondImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewAction:)];
    [self.firstImageView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewSecondAction:)];
    [self.secondImageView addGestureRecognizer:tap1];
}
- (void)bigImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.firstImageView];
}
- (void)bigImageViewSecondAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.secondImageView];
}

+ (CGFloat)height {
    return 220;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
